//引入封装好的接口
import {getMenuList} from '../../../request/api'
//state
const state = {
    menulist:[]
};
//getters
const getters = {
    getMenu(state){
        return state.menulist
    }
};
//mutation
const mutations = {
    REQ_MENULIST(state,payload){
        state.menulist = payload
    }
};
//action
const actions = {
    //封装一个获取菜单列表的行动
    getMenuAction({commit}){
        //调用接口
        getMenuList()
        .then(res=>{
            commit('REQ_MENULIST',res.list)
        })
    }
};
//把封装好的属性导出去
export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true//命名空间 为了 给 getters mutations actions 模块前面添加模块名称 防止冲突
}
